<?php /* Smarty version Smarty-3.1.6, created on 2018-05-29 16:34:13
         compiled from "D:/phpStudy/PHPTutorial/WWW/myshop/Home/View\User\shopcartlist.html" */ ?>
<?php /*%%SmartyHeaderCode:3752894905afe811165b1d4-89895328%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'a22a14a805c71f7701fe54c3174c09fa20d92740' => 
    array (
      0 => 'D:/phpStudy/PHPTutorial/WWW/myshop/Home/View\\User\\shopcartlist.html',
      1 => 1527582852,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '3752894905afe811165b1d4-89895328',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.6',
  'unifunc' => 'content_5afe811170e8e',
  'variables' => 
  array (
    'shopcartlist' => 0,
    'v' => 0,
    'total' => 0,
    'price' => 0,
    'jifen' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5afe811170e8e')) {function content_5afe811170e8e($_smarty_tpl) {?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>购物车</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="<?php echo @PUBLIC_PATH;?>
css/amazeui.min.css"/>
<link rel="stylesheet" href="<?php echo @IMAGES_PATH;?>
style.css"/>
<script src="<?php echo @PUBLIC_PATH;?>
js/jquery.min.js"></script>
<script src="<?php echo @PUBLIC_PATH;?>
js/amazeui.min.js"></script>
</head>
<script>
	var goods=new Array();
</script>
<body>
<div class="container">
	<!--引入头文件-->
	<?php echo $_smarty_tpl->getSubTemplate ("../header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

	<script>$('.title-link').text("购物车")</script>
    
    <form action="<?php echo @__MODULE__;?>
/Order/makeorder" method="post">
    <div class="am-cf cart-panel">
    	<div class="cart-list-panel" style="min-height: 700px;">
            <ul class="am-avg-sm-1 cart-panel-ul">
            	<?php if (empty($_smarty_tpl->tpl_vars['shopcartlist']->value)){?>
    				<div class="cart_foot" style="text-align: center;">购物车是空的┭┮﹏┭┮</div>
    				<a href="<?php echo @__MODULE__;?>
/IntegralGoods/cats"><div class="cart_foot" style="text-align: center;">去浏览下吧</div></a>
            	<?php }else{ ?>
            	<?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['shopcartlist']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
$_smarty_tpl->tpl_vars['v']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                <a href="<?php echo @__MODULE__;?>
/IntegralGoods/goodsdetail/id/<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
">
                <li>
                	<div class="imgpanel"><img src="<?php echo $_smarty_tpl->tpl_vars['v']->value['main_img'];?>
" class="am-img-responsive" /></div>
                	<div class="infopanel">
                    	<h3><?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
</h3>
                    	<p><input name="goods[<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
][id]" value="<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
" style="display: none;"> </p>
                    	<p><input name="goods[<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
][name]" value="<?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
" style="display: none;"> </p>
                    	<p><input name="goods[<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
][price]" value="<?php echo $_smarty_tpl->tpl_vars['v']->value['price'];?>
" style="display: none;"> </p>
                    	<p><input name="goods[<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
][main_img]" value="<?php echo $_smarty_tpl->tpl_vars['v']->value['main_img'];?>
" style="display: none;"> </p>
                        <p>数量<span class="red2 bold">&nbsp;&nbsp;&nbsp;</span><input class="am-input-sm txt-qty quantity" type="number" name="goods[<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
][quantity]" value="<?php echo $_smarty_tpl->tpl_vars['v']->value['quantity'];?>
" /></p>
                        <p>收藏数：<span class="red2 bold"><?php echo $_smarty_tpl->tpl_vars['v']->value['fav_cnt'];?>
</span>  </p>
                        <p>价格：<span class="red2 bold"><?php echo $_smarty_tpl->tpl_vars['v']->value['price'];?>
积分</span></p>
                        <p>库存：<span class="red2 bold"><?php echo $_smarty_tpl->tpl_vars['v']->value['count'];?>
</span> 件<span class="am-fr"><a data-id="<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
" class="am-badge am-badge-danger am-round deleteshopcart">删除</a></span></p>
                    </div>
                </li>
                    </a>
                <?php } ?>
                <?php }?>
            </ul>
            
        </div>
    </div>
    <div class="cart_foot" style="display: none;">共选中<span class="red2 bold" id="total_good"><?php echo $_smarty_tpl->tpl_vars['total']->value;?>
</span>种商品；总价：<span class="red2 bold" id="total_amount"><?php echo $_smarty_tpl->tpl_vars['price']->value;?>
</span>元；总积分：<span class="red2 bold" id="total_jifen"><?php echo $_smarty_tpl->tpl_vars['jifen']->value;?>
</span></div>
    <div class="cart-tool">
    	<a class="am-btn am-btn-sm am-btn-success" href="javascript:history.back()">
          <i class="am-icon-chevron-left"></i>
          返回
        </a>
        <a class="am-btn am-btn-sm am-btn-warning makeorder" >
          <i class="am-icon-shopping-cart"></i>
          <!--<input type="submit"  value="结账" />-->
          		结账
        </a>
    </div>
    </form>
    
    <footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
        <hr data-am-widget="divider" style="" class="am-divider am-divider-default"/>
      <div class="am-footer-miscs ">
        <p>CopyRight©2014 AllMobilize Inc.</p>
        <p>京ICP备13033158</p>
      </div>
    </footer>
    <!--底部-->
    <?php echo $_smarty_tpl->getSubTemplate ("../footer.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

</div>
<script>
	$('.deleteshopcart').click(function(){
//		var thisgoods=$(this);
//		var id=thisgoods.data('id');
//		$('.favli'+id).hide();
		if(confirm("确定删除该商品吗？")){
			var thisgoods=$(this);
			var data={
				id:thisgoods.data('id'),
			}
		$.post("<?php echo @__CONTROLLER__;?>
/deleteshopcart", data, function(ret){
			console.log(ret);
			if(ret){
//				$('.favli'+data.id).hide();
				window.location.reload();
//				alert("收藏了");
			}else{
				alert("删除失败");
//				alert("取消了");
			}
		})
		}
	})
	
//	$('.makeorder').click(function(){
////		alert("d");
////		var lis=$('.cart-panel-ul li');
////		for(var i=0;i<lis.length;i++){
//////			var oneli=lis[i];
////			console.log(lis[i].children(".infopanel"));
////		}
////		var data=new Array();
//		var i=0;
//		var goods=new Array();
//		$('.cart-panel-ul').find('li').each(function() { //获取所有商品id和数量信息
////              console.log($(this));
//              var id=$(this).children(".infopanel").children("p:eq(0)").text();
//              var quantity=$(this).children(".infopanel").children("p:eq(1)").children("input").val();
//          	goods[i]=[{
//          		id:id,
//          		quantity:quantity,
//          	}]
//          	i++;
////				console.log(id)
////				console.log(quantity)
//		})
//		var data={ goods:goods,}
//		$.post("<?php echo @__MODULE__;?>
/Order/makeorder", data)
////		console.log(data);
//	})
$('.makeorder').click(function(){
	$("form").submit();
})
</script>
</body>
</html>
<?php }} ?>